import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter02/res/list_data.dart';

class MyHomePage extends StatelessWidget {
  MyHomePage({super.key}) {
    if (kDebugMode) {
      print(listData);
    }
  }

  List<Widget> _initListData() {
    var tempList = listData.map((value) => ListTile(
          leading: Image.network("${value['imageUrl']}"),
          title: Text("${value['title']}"),
          subtitle: Text("${value['author']}"),
        ));
    return tempList.toList();
  }

  @override
  Widget build(BuildContext context) {
    return ListView(children: _initListData());
  }
}
